#pragma once

#include "imgui/imgui.h"
#include "imgui/pch.h"

#include "dut/Transform.h"
#include "dut/Camera.h"
#include "dut/Frustum.h"
#include "dut/CpuTimer.h"
#include "dut/Texture2D.h"


namespace ImGui
{

	struct DutEditor
	{

		bool EditTransform(Dut::Transform& inst)
		{
			bool res = false;
			ImGui::PushID(&inst);
			res |= (ImGui::DragFloat3("Pos", &inst.position.x));
			res |= (ImGui::DragFloat3("Rot", &inst.rotation.x));
			res |= (ImGui::DragFloat3("Scale", &inst.scale.x));

			ImGui::PopID();

			return res;
		}

		bool EditCamera(Dut::Camera& inst)
		{
			bool res = false;

			res |= (EditTransform(inst));

			return false;
		}

		bool EditFrustum(Dut::Frustum& inst)
		{
			bool res = false;

			res |= ImGui::InputFloat("fovy", &inst.fovy, 0.0f);
			res |= ImGui::InputFloat("nearZ", &inst.nNear);
			res |= ImGui::InputFloat("farZ", &inst.nFar);
			return res;
		}
		bool ShowTexture2D(const Dut::Texture2D& tex, const ImVec2& sz = ImVec2(50, 50));

		struct MoveDesc
		{
			float mWheelSpeed = 2.0f;
			float middleMoveAxis = 0.001f;
			float rotXspeed = 0.5f;
			float rotYspeed = 0.2f;
		};
		struct WorkDesc
		{
			float walkSpeed = 30.0f;
			float trunSpeed = 15.0f;
			float rotSpeedX = 6.0f;
			float rotSpeedY = 6.0f;
		};


		bool FreeMove(Dut::Transform& transform, const WorkDesc& desc = {});
	};
}